import request from "@/utils/request"
import { addCommunityNewsParams, findCommunityListParams, modifyCommunityNewsParams } from "@/views/message/type"

// 查看社区资讯列表
export function reqFindCommunityList(params: Partial<findCommunityListParams>) {
    return request({
        url: '/findCommunityNews',
        method: 'post',
        data: params,
    })
}

// 添加社区资讯
export function reqAddCommunityNews(params: Partial<addCommunityNewsParams>) {
    return request({
        url: '/addCommunityNews',
        method: 'post',
        data: params,
    })
}

// id查找社区资讯
export function reqFindCommunityNewsById(params: { id: string }) {
    return request({
        url: '/findCommunityNewsById',
        method: 'post',
        data: params,
    })
}
// 修改社区资讯
export function reqModifyCommunityNews(params: modifyCommunityNewsParams) {
    return request({
        url: '/modifyCommunityNews',
        method: 'post',
        data: params,
    })
}
// 删除社区资讯
export function reqRemoveCommunityNews(params: { id: string }) {
    return request({
        url: '/removeCommunityNews',
        method: 'post',
        data: params,
    })
}
// 上传图片
export function reqUploadPic(params: { image: File }) {
    return request({
        url: '/uploadPic',
        method: 'post',
        data: params,
        headers: {
            "Content-Type": 'multipart/form-data'
        }
    })
}